<template>
	<view class="my-same-trade-lists-area">
		<navigator hover-class="none" :url="`/yixu/pages/network_square/contents/info?id=${v.id}&type=2`" class="my-same-trade-item u-padding-30" v-for="(v, index) in listDatas" :key="index">
			<view class="u-flex u-padding-bottom-10">
				<view class="u-flex u-flex-1">
					<text class="md">{{ v.create_time }}</text>
					<text class="md u-padding-left-10 u-padding-right-10">发布</text>
				</view>
			</view>

			<u-icon :label="v.type_desc" size="30" name="tags-fill" color="#66a6ff" label-color="#66a6ff"></u-icon>

			<view v-if="v.type == 1" class="area-bg u-border-radius-10 u-margin-top-15 u-padding-20">
				<view>
					<text class="bold">产品名称 :</text>
					<text class="u-font-weight-500 u-padding-left-10">{{ v.product_name || '' }}</text>
				</view>
				<view class="u-margin-top-15">
					<text class="bold">产品月息 :</text>
					<text class="u-font-weight-500 u-padding-left-10">{{ v.interests || '' }}</text>
				</view>
				<view class="u-margin-top-15">
					<text class="bold">产品额度 :</text>
					<text class="u-font-weight-500 u-padding-left-10">{{ v.quota || 0 }}万</text>
				</view>
				<view>
					<view class="bold u-margin-top-15">
						产品优势描述 :
					</view>
					<view class="nr u-margin-top-15">
						{{ v.describe || '' }}
					</view>
				</view>
			</view>
			<view class="area-bg u-border-radius-10 u-margin-top-15 u-padding-20">
				<view class="bold u-padding-right-10">合作需求 :</view>
				<view class="u-padding-top-10">
					{{ v.demand || '' }}
				</view>
			</view>

			<view class="u-flex  u-color-666666 xs u-margin-top-25 u-padding-bottom-25">
				<view class="u-flex-1"></view>
				<u-icon :label="v.look_count" name="eye" size="24" label-size="24" class="u-padding-right-30"></u-icon>
				<like :isSelect="v.is_like" :likeCount="v.like_count" :articleType="2" :articleId="v.id"></like>
				<!-- <u-icon :label="33" name="chat" size="24" label-size="24"></u-icon> -->
			</view>
		</navigator>

		<u-empty v-if="listDatas.length <= 0" class="u-padding-top-50 u-padding-bottom-50" text="暂无数据"
			mode="list"></u-empty>

	</view>
</template>

<script>
	import {
		queryCooperationLists
	} from '@/api/networkSquare.js'
	import {
		loadingType
	} from "@/utils/type";
	import {
		loadingFun
	} from "@/utils/tools"
	import like from '@/yixu/pages/network_square/components/like.vue'
	export default {
		components:{
			like
		},
		data() {
			return {
				page: 1,
				listDatas: [],
				initStatus: false,
				loadingStatus: loadingType.LOADING,
			}
		},
		props:{
			userId:{
				type:Number|String,
				default:0
			}
		},
		created() {
			this.queryListsDatas()
		},
		methods: {
			clearDatas() {
				this.page = 1;
				this.listDatas = [];
				this.loadingStatus = loadingType.LOADING;
			},
			queryListsDatas() {
				let requestParams = {
					user_id:this.userId
				}
				let {
					page,
					listDatas,
					loadingStatus
				} = this;
				loadingFun(queryCooperationLists, page, listDatas, loadingStatus, requestParams).then(res => {
					if (res) {
						this.page = res.page;
						this.listDatas = res.dataList
						this.loadingStatus = res.status
						console.log(listDatas)
						if (!this.initStatus) {
							this.$emit('initComplete')
							this.initStatus = true
						}

					}
				})
			}
		}
	}
</script>


<style lang="scss">
	.my-same-trade-item {
		border-bottom: 2rpx solid #F5F5F5;

		&:last-child {
			border-bottom-color: transparent;
		}
	}

	.more-icon {
		transform: rotate(90deg);
	}

	.area-bg {
		background: #F7F7F7;
	}
</style>